﻿using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

namespace XFFSM
{

    public class FSMBoolConditionInspector : FSMConditionInspector
    {

        public override void OnGUI(Rect rect, FSMConditionData condition, RuntimeFSMController controller)
        {
            string text = condition.targetValue == 1 ? "True" : "False";
            if (EditorGUI.DropdownButton(rect, new GUIContent(text), FocusType.Keyboard)) {

                GenericMenu menu = new GenericMenu();
                 
                menu.AddItem(new GUIContent("True"), condition.targetValue == 1, () => {
                    condition.targetValue = 1;
                    controller.Save();
                });

                //tempContent.text = "False";
                menu.AddItem(new GUIContent("False"), condition.targetValue == 0, () => {
                    condition.targetValue = 0;
                    controller.Save();
                });

                menu.ShowAsContext();
            }

        }
    }

}
